import {Module} from '@nestjs/common';
import {TypeOrmModule} from "@nestjs/typeorm";
import config from "./config";
import {SysUserModule} from "./module/SysUserModule";
import {AuthModule} from "./auth/AuthModule";
import {SysMenuModule} from "./module/SysMenuModule";
import {SysRoleModule} from "./module/SysRoleModule";
import {GlobalSerializeProvider} from "./common/pipe/MyDtoSerializePipe";
import { UnitModule } from './module/StockModule';
import { GoodsModule } from './module/GoodsModule';

@Module({
  imports: [
      TypeOrmModule.forRoot({
          type: 'mysql',
          host: config.mysql.host,
          port: config.mysql.port,
          username: config.mysql.username,
          password: config.mysql.password,
          database: config.mysql.database,
          entities: config.mysql.entities,
          synchronize: config.mysql.doSync,
          logging: config.mysql.logging
      }),
      SysUserModule,
      AuthModule,
      SysMenuModule,
      SysRoleModule,
      UnitModule,
      GoodsModule
  ],
  controllers: [],
  providers: [
      // Dto全局序列化和反序列化
      GlobalSerializeProvider
  ],
})
export class AppModule {}
